HuffComp - Analysis
These results show that Huffman compression was consistently effective across all files, with a huge range of complexity, but its effectiveness, defined as compression ratio (“CR”, number of compressed bits divided by number of uncompressed bits), clearly depends on how closely the character frequency distribution of the weights file matches that of the file being compressed. In every case, meaningful compression was achieved (Average CR 0.614, standard deviation of 0.047), with the best performance occurring when a file was compressed using weights generated from itself (e.g., War and Peace achieving 0.563 and Cat in the Hat 0.550). One thing I noticed is how texts of a similar complexity often compressed fairly well: When Cat in the Hat (a less complex text) weights were used, texts like Simple and Simpler performed above-average in terms of CR. Conversely, when War and Peace weights were used, simple and simpler had the worst CR. Despite this, one somewhat surprising result is how well cross-file compression still performed- using War and Peace weights on other novels worked reasonably well, suggesting natural language shares broadly similar statistical patterns. If I had to choose one weights file to compress any unknown file, I would pick War and Peace, as it overall had the best CR, of 0.60; Cat in the Hat had a slightly worse CR of 0.63.